<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ include file="/WEB-INF/page/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
    <title>口子列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <link rel="stylesheet" href="${ctx }/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${ctx }/css/font_eolqem241z66flxr.css"
          media="all" />
    <link rel="stylesheet" href="${ctx }/css/list.css" media="all" />

    <script>
        var ctx = "${ctx}";
    </script>
</head>

</head>
<body>

<div class="childrenBody" id="rrapp">
    <input type="hidden" id="adminId"
           value="<shiro:principal property="id"/>" />
    <blockquote class="layui-elem-quote list_search">
        <shiro:hasPermission name="sys:admin:save">
            <div class="layui-inline">
                <a class="layui-btn layui-btn-normal cardAdd_btn"><i
                        class="layui-icon">&#xe608;</i> 添加口子</a>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="sys:admin:delete">
            <div class="layui-inline">
                <a class="layui-btn layui-btn-danger batchDel"><i
                        class="layui-icon">&#xe640;</i>批量删除</a>
            </div>
        </shiro:hasPermission>
        <%--<div class="layui-inline">--%>
            <%--<div class="layui-form-mid layui-word-aux"><a class="layui-btn layui-btn-danger" id="testdata" ><i--%>
            <%-->&#xe640;</i>测试数据</a>--%>
            <%--</div>--%>
        <%--</div>--%>
    </blockquote>

    <table class="layui-table" lay-data="{ url:'${ctx}/jieqians/list', method:'post',  page:true, id:'listTable'}" lay-filter="list">
        <thead>
        <tr>
            <th lay-data="{type:'checkbox', fixed: 'left'}"></th>
            <th lay-data="{field:'id',width:40 }">ID</th>
            <th lay-data="{field:'name',width:100}">口子名称</th>
            <th lay-data="{field:'advantage',width:200}">特点</th>
            <th lay-data="{field:'image',width:300}">图标</th>
            <th lay-data="{field:'view',width:80}">浏览量</th>
            <th lay-data="{field:'hot',templet:'#hot',width:90}">文章状态</th>
            <th lay-data="{field:'pass',width:90}">通过率%</th>
            <th lay-data="{field:'min',width:90}">最低借款</th>
            <th lay-data="{field:'max',width:90}">最高借款</th>
            <th lay-data="{field:'timeUnit',width:120}">借款期限单位</th>
            <th lay-data="{field:'minTime',width:120}">最低借款期限</th>
            <th lay-data="{field:'maxTime',width:120}">最高借款期限</th>
            <th lay-data="{field:'rate',width:60}">利率</th>
            <th lay-data="{field:'fangkuanTime',width:90}">放款时间</th>
            <th lay-data="{field:'liucheng',width:300}">放款流程</th>
            <th lay-data="{field:'tiaojian',width:300}">放款条件</th>
            <th lay-data="{field:'cailiao',width:300}">放款材料</th>
            <th lay-data="{field:'link',width:300}">跳转链接</th>
            <th lay-data="{field:'createdAt',templet:'#creatTpl',width:100}">创建时间</th>
            <th lay-data="{field:'updatedAt',templet:'#updateTpl',width:100}">修改时间</th>
            <%--<th lay-data="{field:'deletedAt',templet:'#deleteTpl',width:100}">删除时间</th>--%>
            <th lay-data="{fixed: 'right', align:'center', toolbar: '#bar' ,width:150 }">操作</th>
        </tr>
        </thead>
    </table>
    <script type="text/javascript" src="${ctx }/layui/layui.js"></script>
    <script type="text/javascript" src="${ctx }/page/kouzijihe/jieqians.js"></script>
    <script type="text/html" id="bar">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script type="text/html" id="creatTpl">
        <div>{{ formatTime(d.createdAt,"yyyy-MM-dd")}}</div>
    </script>
    <script type="text/html" id="updateTpl">
        <div>{{ formatTime(d.updatedAt,"yyyy-MM-dd")}}</div>
    </script>
    <script type="text/html" id="deleteTpl">
        <div>{{ formatTime(d.deletedAt,"yyyy-MM-dd")}}</div>
    </script>
</div>
<script>

    //格式化时间
    function formatTime(datetime, fmt) {
        if (datetime == null || datetime == 0) {
            return "";
        }
        if (parseInt(datetime) == datetime) {
            if (datetime.length == 10) {
                datetime = parseInt(datetime) * 1000;
            } else if (datetime.length == 13) {
                datetime = parseInt(datetime);
            }
        }
        datetime = new Date(datetime);
        var o = {
            "M+" : datetime.getMonth() + 1, //月份
            "d+" : datetime.getDate(), //日
            "h+" : datetime.getHours(), //小时
            "m+" : datetime.getMinutes(), //分
            "s+" : datetime.getSeconds(), //秒
            "q+" : Math.floor((datetime.getMonth() + 3) / 3), //季度
            "S" : datetime.getMilliseconds()
            //毫秒
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (datetime.getFullYear() + "")
                .substr(4 - RegExp.$1.length));
        for ( var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1,
                    (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k])
                        .substr(("" + o[k]).length)));
        return fmt;
    }
</script>
<script type="text/html" id="hot">
    {{#  if(d.hot == 0){ }}
    不热门
    {{#  } else { }}
    热门
    {{#  } }}
</script>
</body>
</html>